﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="MessageBox.aspx.cs" Inherits="SCS.Web.UI.WebControls.Dialogs.Test.MessageBox" %>
<%@ Register assembly="SCS.Web.UI.WebControls.Dialogs" namespace="SCS.Web.UI.WebControls.Dialogs" tagprefix="cc1" %>
<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="act" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">

</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

    <h2>MessageBox</h2>
    
    <br /><br />

    <asp:LinkButton ID="submitConfirmationDialogButton" runat="server" Text="Submit Confirmation" /> <br /><br />

    <asp:LinkButton ID="launchDialogButton" runat="server" Text="Show MessageBox (From Client)" /> <br /><br />
    
    <asp:LinkButton id="launchDialogButtonFromServer" runat="server" 
        Text="Show MessageBox (From Server)" 
        onclick="launchDialogButtonFromServer_Click" />  <br /><br />

    <asp:LinkButton id="launchDialogButtonFromServerWithQuestion" runat="server" 
        Text="Show Question MessageBox (From Server)" 
        onclick="launchDialogButtonFromServerWithQuestion_Click" /> <br /><br />

    Dialog Result: <asp:Label ID="serverDialogResult" runat="server" ClientIDMode="Static" />

    <cc1:MessageBox ID="dialog1" runat="server"        
        CssClass="dialog msg-dialog"
        BackgroundCssClass="modalBackground"         
        Title="MessageBox Example"
        Text="This is a sample MessageBox."        
        TargetControlId="launchDialogButton"              
        ShowTitlebarCloseButton="false"
        ShowCloseButton="false" 
        ShowOkButton="false" 
        Buttons="OK" 
        Icon="Information" />
        
    <cc1:MessageBox ID="confirmDialog" runat="server"        
        CssClass="dialog msg-dialog"
        BackgroundCssClass="modalBackground"         
        Title="Confirmation"
        Text="Are you sure you want to submit?"        
        TargetControlId="submitConfirmationDialogButton"              
        ShowTitlebarCloseButton="false"
        ShowCloseButton="false" 
        ShowOkButton="false" 
        Buttons="YesNo"
        Icon="Question"
        DefaultButton="Button2" 
        ConfirmMode="true" />

    <cc1:MessageBox ID="dialogFromServer" runat="server"        
        CssClass="dialog msg-dialog"
        BackgroundCssClass="modalBackground"                 
        ShowTitlebarCloseButton="false"
        ShowCloseButton="false" 
        ShowOkButton="false" 
        OnButtonClicked="dialogFromServer_ButtonClicked"
        PostBack="true"
        ErrorIconImage="~/images/error.gif"
        InformationIconImage="~/images/info.gif"
        WarningIconImage="~/images/warning.gif" 
        QuestionIconImage="~/images/question.gif" 
        CloseButtonImage="~/images/close.gif" />

    <script type="text/javascript">

        function pageLoad () {

            var clientDialog = $find("<%= dialog1.ClientID %>");

            clientDialog.add_Hidden(clientDialog_hidden);
        }

        function clientDialog_hidden(sender, args) {

            switch (sender.get_Result()) {

                case SCS.DialogResult.OK:
                    $("#serverDialogResult").text("OK");
                    break;

                case SCS.DialogResult.Cancel:
                    $("#serverDialogResult").text("Cancel");
                    break;

                case SCS.DialogResult.Cancel:
                    $("#serverDialogResult").text("Cancel");
                    break;

                case SCS.DialogResult.Yes:
                    $("#serverDialogResult").text("Yes");
                    break;

                case SCS.DialogResult.No:
                    $("#serverDialogResult").text("No");
                    break;
            }
        }
    </script>
</asp:Content>
